package com.wwmz.mebatis.v2.plugin;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * 包装类，对被代理对象进行包装
 * Created by wumz on 2020/10/17 13:57
 */
public class Invocation {
    private Object target;
    private Method method;
    private Object[] args;

    public Invocation(Object target, Method method, Object[] args){
        this.target = target;
        this.method = method;
        this.args = args;
    }

    /**
     * 继续执行原逻辑
     * @return
     */
    public Object proceed() throws InvocationTargetException, IllegalAccessException {
        return method.invoke(target, args);
    }

    public Object[] getArgs() {
        return args;
    }
}
